package com.cqut.forum.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author yangxun
 * PictureGroup entity
 */
@Entity
@Table(name = "picture_group", catalog = "forum")
public class PictureGroup implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer pictureGroupId;
	private Integer ownerId;
	//private Date pictureGroupTime;
	private Integer pictureNumber;
	private Boolean isPublic;
	private String pictureGroupName;
	private String picturePassword;
	private String markPictureUrl;
	private Set<Picture> pictures = new HashSet<Picture>(0);

	// Constructors

	/** default constructor */
	public PictureGroup() {
	}

	/** full constructor */
	public PictureGroup(Integer ownerId, /*Date pictureGroupTime,*/String picturePassword,		
			Integer pictureNumber, Boolean isPublic, String pictureGroupName,
			String markPictureUrl,Set<Picture> pictures) {
		this.ownerId = ownerId;
		//this.pictureGroupTime = pictureGroupTime;
		this.pictureNumber = pictureNumber;
		this.isPublic = isPublic;
		this.pictureGroupName = pictureGroupName;
		this.picturePassword = picturePassword;
		this.markPictureUrl = markPictureUrl;
		this.pictures = pictures;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "picture_group_id", unique = true, nullable = false)
	public Integer getPictureGroupId() {
		return this.pictureGroupId;
	}

	public void setPictureGroupId(Integer pictureGroupId) {
		this.pictureGroupId = pictureGroupId;
	}

	@Column(name = "owner_id")
	public Integer getOwnerId() {
		return this.ownerId;
	}

	public void setOwnerId(Integer ownerId) {
		this.ownerId = ownerId;
	}

	/*@Column(name = "picture_group_time", length = 10)
	public Date getPictureGroupTime() {
		return this.pictureGroupTime;
	}

	public void setPictureGroupTime(Date pictureGroupTime) {
		this.pictureGroupTime = pictureGroupTime;
	}*/

	@Column(name = "picture_number")
	public Integer getPictureNumber() {
		return this.pictureNumber;
	}

	public void setPictureNumber(Integer pictureNumber) {
		this.pictureNumber = pictureNumber;
	}
	
	@Column(name = "picture_password")	
	public String getPicturePassword() {
		return picturePassword;
	}

	public void setPicturePassword(String picturePassword) {
		this.picturePassword = picturePassword;
	}
	
	@Column(name = "mark_picture_url")	
	public String getMarkPictureUrl() {
		return markPictureUrl;
	}

	public void setMarkPictureUrl(String markPictureUrl) {
		this.markPictureUrl = markPictureUrl;
	}

	@Column(name = "is_public")
	public Boolean getIsPublic() {
		return this.isPublic;
	}

	public void setIsPublic(Boolean isPublic) {
		this.isPublic = isPublic;
	}

	@Column(name = "picture_group_name", length = 20)
	public String getPictureGroupName() {
		return this.pictureGroupName;
	}

	public void setPictureGroupName(String pictureGroupName) {
		this.pictureGroupName = pictureGroupName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "pictureGroup")
	public Set<Picture> getPictures() {
		return this.pictures;
	}

	public void setPictures(Set<Picture> pictures) {
		this.pictures = pictures;
	}

}